<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    const regPhone = /^1[3-9]\d{9}$/
    console.log(
      regPhone.test('11812341234')
    );

    console.log(
      Math.random().toString().slice(-6)
    );

    const getDouble = (str) => {
      if (str.toString().length < 2) {
        str = '0' + str
      }

      return str;
    }

    const formatDate = (date = new Date()) => {
      return `${date.getFullYear()}-${getDouble(date.getMonth() + 1)}-${getDouble(date.getDate())} ${getDouble(date.getHours())}:${getDouble(date.getMinutes())}:${getDouble(date.getSeconds())}`
    }

    console.log(
      formatDate()
    );




    // const date = new Date();
    // console.dir(date);
    // console.dir(date.getDate());
    // console.dir(date.getDay());
    // console.dir(date.getTime());
  </script>
</body>

</html>